# vim:set ft=sh:

install ()
{
    add_dir "/proc"
    add_dir "/sys"
    add_dir "/dev"
    add_dir "/bin"
    add_dir "/sbin"
    add_dir "/lib"
    add_dir "/usr"
    add_dir "/usr/bin"
    add_dir "/usr/lib"
    add_dir "/usr/sbin"

    add_device "/dev/null"    c 1 3
    add_device "/dev/zero"    c 1 5
    add_device "/dev/console" c 5 1
    add_device "/dev/mem"     c 1 1

    #add_binary "${BASEDIR}/lib/initcpio/busybox" "/bin/busybox"
    add_file "${BASEDIR}/lib/initcpio/busybox" "/bin/busybox"

    for file in $(ls -1 ${BASEDIR}/lib/libc.so* 2>/dev/null); do
	[ -f $file ] && add_file "${file}" "${file##$BASEDIR}"
    done

    for file in $(ls -1 ${BASEDIR}/lib/ld-linux* 2>/dev/null); do
	[ -f $file ] && add_file "${file}" "${file##$BASEDIR}"
    done

    #add_binary ${BASEDIR}/sbin/modprobe /sbin/modprobe
    #add_binary ${BASEDIR}/sbin/blkid /sbin/blkid
    add_file ${BASEDIR}/sbin/modprobe /sbin/modprobe
    add_file ${BASEDIR}/sbin/blkid /sbin/blkid
    SO="libblkid.so libuuid.so"
    for so in $SO; do
		for file in $(ls -1 ${BASEDIR}/lib/$so* 2>/dev/null); do
			add_file "${file}" "${file##$BASEDIR}"
		done
    done

    #add_file "${BASEDIR}/lib/initcpio/init_functions" "/init_functions"
    #add_file "${BASEDIR}/lib/initcpio/init" "/init"
    add_file "${CONFIG}" "/config"
    if [ -n "${MESSAGE}" ]; then
        echo -e "${MESSAGE}" > ${MESSAGEFILE}
        add_file "${MESSAGEFILE}" "/message"
    fi
    add_file "/etc/modprobe.d/usb-load-ehci-first.conf"
    SCRIPT=""
}

help ()
{
cat <<HELPEOF
  This hook sets up all initial directories and installs base
  utilities. DO NOT remove this one unless you know what you're
  doing.
HELPEOF
}
